#include <stdio.h>
#include <math.h>
int Daff(int num){
	int sum = 0;
	int num1 = num;
	int i = 0;
	while(num1 != 0){
		i++;
		num1 /= 10;
	}
	num1 = num;
	while(num1 != 0){
		sum += (int)pow(num1%10,i);
		num1 /= 10;
	}
	if(sum == num)
		return 1;
	else
		return 0;
}
int main(){
	for(int i = 0; i <= 100000; i++){
		if(Daff(i) == 1)
			printf("%d ",i);
	}
}
